home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / RCS / SharedMemory.cc,v < prev    next >
Text File  |  1988-09-21  |  1KB  |  79 lines

  1. head     1.2;
  2. access   ;
  3. symbols  ;
  4. locks    ; strict;
  5. comment  @@;
  6.  
  7.  
  8. 1.2
  9. date     88.09.21.20.51.41;  author grunwald;  state Exp;
  10. branches ;
  11. next     1.1;
  12.  
  13. 1.1
  14. date     88.09.18.16.42.29;  author grunwald;  state Exp;
  15. branches ;
  16. next     ;
  17.  
  18.  
  19. desc
  20. @@
  21.  
  22.  
  23. 1.2
  24. log
  25. @*** empty log message ***
  26. @
  27. text
  28. @#include "SharedMemory.h"
  29. #include "SharedMalloc.h"
  30. #include "assert.h"
  31.  
  32. extern char *sbrk(unsigned);
  33. extern void perror(char *);
  34. extern void exit(int x = 0);
  35.  
  36. //
  37. //    Not really a part of HardwareCpu, but used by it & hidden here.
  38. //
  39. void
  40. SharedMemoryInit( unsigned extra )
  41. {
  42.     //
  43.     // Bump the break if necessary.
  44.     // 
  45.     assert(extra >= 0);
  46.     char * newBreak = sbrk( extra );
  47.     if ( newBreak == (char *) -1 ) {
  48.     perror( "Share: sbrk" );
  49.     exit( 1 );
  50.     }
  51.     newBreak = sbrk( 0 );
  52.     
  53.     //
  54.     // Share .data, .bss, and the extra.
  55.     // 
  56.     extern int environ;
  57.     extern char * share( unsigned, unsigned );
  58.     unsigned shareStart = (unsigned) &environ;
  59.     unsigned shareSize = (unsigned) newBreak - shareStart;
  60.     char * sharePointer = share( shareStart, shareSize );
  61.     if ( sharePointer == 0 ) {
  62.     perror( "Share: share" );
  63.     exit( 1 );
  64.     }
  65.  
  66.     HardwareMemoryAllocator.disableFurtherBreaks();
  67. }
  68. @
  69.  
  70.  
  71. 1.1
  72. log
  73. @Initial revision
  74. @
  75. text
  76. @d2 1
  77. d38 2
  78. @
  79.